home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles Flirt Up Your Life! (German)
/
Singles Flirt Up Your Life.iso
/
data1.cab
/
Statemachine
/
hoover.lua
< prev
next >
Wrap
Text File
|
2004-01-29
|
1KB
|
49 lines
-- hoover state machine
beginStateMachine()
onMsg("buildMenu", function(msg)
if (repairMenu()) then return end
-- build the pie menu
clearPieMenu();
local button;
button = addPieMenuButton("pm_cleanFloor", "cleanFloor");
button.addDescription(ACTIVITY, "cleanFloor");
button.addDescription(ACTIVITY, "improveFloorTidiness");
button.addIcon("guiIconWohnung");
end )
--
onMsg("cleanFloor", function(msg)
-- get the game object server
local gameObjectServer = getGameObjectServer();
-- get character who initiated this action
local character = getStateObjectFromID(msg.sender);
-- get the walk state object
local wso = character.walkSO;
local holds, hand = holdsObject(character, "hoover")
if (holds) then
wso.queueStateMachine("cleanFloorChar.findDirt", this);
else
-- walk to the closest action point
local actionPoint = character.getFreeActionPoint(this, "take");
if (actionPoint) then
if (wso.walkToActionPoint(actionPoint)) then
wso.queueStateMachine("cleanFloorChar.takeHoover", this);
else
print("no path found");
instantAbort(character, EMOTICON_NOPATH, "emoThink")
end
else
print("no action point found");
instantAbort(character, EMOTICON_CANNOT, "emoThink")
end
end
end )
endStateMachine()